<%@ page language="java" pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>


<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">


<html>
	<head>

		<base href="<%=basePath%>">

		<title>Create Lead</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

	</head>

	<body>
		<f:view>
			<a4j:form style="align: left;">

				<h:commandLink id="cl1" value="Log Out"
					action="#{authenticationController.logout}" immediate="true">
				</h:commandLink>

				<rich:spacer width="11"></rich:spacer>

				<h:commandLink id="cl2" value="Back to Dashboard"
					action="#{leadController.navigateToSalesAgentDashboard}"
					immediate="true">
				</h:commandLink>

				<h:inputHidden id="ih" value="#{leadController.tempVar}"></h:inputHidden>

				<rich:panel id="panel" header="#{bundle.CREATE_LEAD_HEADER}"
					style="width: 900px; height: 749px;">

					<h:outputText value="#{bundle.CREATE_LEAD_INPUT_PROMPT_MSG }" />

					<h:form id="createLeadFormId" style="height: 673px; width: 695px">

						<rich:messages globalOnly="true"></rich:messages>

						<table border="0" cellpadding="0" cellspacing="10" width="100%">

							<tr>
								<td width="25%" align="right">
									<h:outputLabel for="firstname" value="firstname"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>
								</td>
								<td width="75%" align="left">
									<h:inputText value="#{leadController.lead.firstname}"
										id="firstname" label="firstname" required="true"
										requiredMessage=" Firstname is required."
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">
										<a4j:support id="firstName" event="onblur"
											reRender="fnameErrMsg" ajaxSingle="true" limitToList="true" />
									</h:inputText>

									<rich:spacer width="5"></rich:spacer>

									<rich:message id="fnameErrMsg" for="firstname" passedLabel="*"
										style='color:red; font-size: 11px;' showDetail="false"
										showSummary="true"></rich:message>

								</td>


							</tr>

							<tr align="left">

								<td width="10%" align="right">
									<h:outputLabel for="lastname" value="lastname"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

								</td>

								<td width="60%">

									<h:inputText value="#{leadController.lead.lastname}"
										id="lastname" label="lastname" required="true"
										requiredMessage=" Lastname is required."
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">

										<a4j:support id="lastName" event="onblur"
											reRender="lnameErrMsg" ajaxSingle="true" limitToList="true" />
									</h:inputText>

									<rich:spacer width="5"></rich:spacer>

									<rich:message id="lnameErrMsg" for="lastname" passedLabel="*"
										style='color:red; font-size: 11px;' showDetail="false"
										showSummary="true"></rich:message>

								</td>

							</tr>

							<tr align="left">
								<td align="right">
									<h:outputLabel for="email" value="email"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

								</td>

								<td>
									<h:inputText value="#{leadController.lead.email}" id="email"
										label="email"
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">

									</h:inputText>

									<rich:spacer width="5"></rich:spacer>

								</td>
							</tr>

							<tr align="right">
								<td>
									<h:outputLabel for="phone" value="phone"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

								</td>

								<td align="left">
									<h:inputText id="phone" value="#{leadController.lead.phone}"
										label="phone"
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">

									</h:inputText>

									<rich:spacer width="5"></rich:spacer>

								</td>

							</tr>



							<tr align="right">
								<td>
									<h:outputLabel for="mobile" value="mobile"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

								</td>

								<td align="left">
									<h:inputText id="mobile" value="#{leadController.lead.mobile}"
										label="mobile"
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">

									</h:inputText>

									<rich:spacer width="5"></rich:spacer>



								</td>

							</tr>


							<tr align="right">
								<td>
									<h:outputLabel for="title" value="title"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

								</td>

								<td align="left">
									<h:inputText id="title" value="#{leadController.lead.title}"
										label="mobile"
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">

									</h:inputText>

									<rich:spacer width="5"></rich:spacer>



								</td>

							</tr>

							<tr align="right">
								<td>

									<h:outputLabel for="leadSource" value="lead source"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

								</td>

								<td align="left">

									<h:selectOneMenu id="leadSource"
										value="#{leadController.lead.leadsource}">


										<f:selectItems value="#{leadController.leadSourceSelectItems}" />
									</h:selectOneMenu>

								</td>

							</tr>


							<tr align="right">
								<td>

									<h:outputLabel for="industry" value="industry"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

								</td>

								<td align="left">

									<h:selectOneMenu id="industry"
										value="#{leadController.lead.industry}">


										<f:selectItems value="#{leadController.industrySelectItems}" />
									</h:selectOneMenu>

								</td>

							</tr>


							<tr align="right">
								<td>
									<h:outputLabel for="anualRevenue" value="anual revenue"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

								</td>

								<td align="left">
									<h:inputText id="anualRevenue"
										value="#{leadController.lead.annualrevenue}"
										label="anualRevenue"
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">

									</h:inputText>

									<rich:spacer width="5"></rich:spacer>


								</td>

							</tr>


							<tr align="right">
								<td>
									<h:outputLabel for="compaignSource" value="campaign source"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

								</td>

								<td align="left">
									<h:inputText id="compaignSource"
										value="#{leadController.lead.compaignsource}"
										label="compaignSource"
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">

									</h:inputText>

									<rich:spacer width="5"></rich:spacer>


								</td>

							</tr>


							<tr align="right">
								<td>
									<h:outputLabel for="companyName" value="company name"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

								</td>

								<td align="left">
									<h:inputText id="companyName"
										value="#{leadController.lead.companyname}" label="companyName"
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">

									</h:inputText>

									<rich:spacer width="5"></rich:spacer>



								</td>

							</tr>


							<tr align="right">
								<td>
									<h:outputLabel for="fax" value="fax"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

								</td>

								<td align="left">
									<h:inputText id="fax" value="#{leadController.lead.fax}"
										label="fax"
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">

									</h:inputText>

									<rich:spacer width="5"></rich:spacer>



								</td>

							</tr>


							<tr align="right">
								<td>
									<h:outputLabel for="website" value="website"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

								</td>

								<td align="left">
									<h:inputText id="website"
										value="#{leadController.lead.website}" label="website"
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">

									</h:inputText>

									<rich:spacer width="5"></rich:spacer>



								</td>

							</tr>


							<tr align="right">
								<td>

									<h:outputLabel for="leadstatus" value="lead status"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

								</td>

								<td align="left">

									<h:selectOneMenu id="leadstatus"
										value="#{leadController.lead.leadstatus}">


										<f:selectItems value="#{leadController.leadStatusSelectItems}" />
									</h:selectOneMenu>

								</td>

							</tr>


							<tr align="right">
								<td>
									<h:outputLabel for="numOfEmployees" value="number of employees"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

								</td>

								<td align="left">
									<h:inputText id="numOfEmployees"
										value="#{leadController.lead.numberofemployees}"
										label="website"
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">

									</h:inputText>

									<rich:spacer width="5"></rich:spacer>


								</td>

							</tr>

							<tr align="right">
								<td>

									<h:outputLabel for="rating" value="lead rating"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

								</td>

								<td align="left">

									<h:selectOneMenu id="rating"
										value="#{leadController.lead.rating}">


										<f:selectItems value="#{leadController.leadRatingSelectItems}" />
									</h:selectOneMenu>

								</td>

							</tr>

							<tr align="right">
								<td>
									<h:outputLabel for="liveID" value="liveID"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

								</td>

								<td align="left">
									<h:inputText id="liveID" value="#{leadController.lead.liveid}"
										label="liveID"
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">

									</h:inputText>

									<rich:spacer width="5"></rich:spacer>



								</td>

							</tr>


							<tr align="right">
								<td>

									<h:outputLabel for="street" value="street"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

								</td>

								<td align="left">

									<h:inputText id="street" value="#{leadController.lead.street}"
										label="street" required="true"
										requiredMessage=" Street address is required."
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">

										<a4j:support id="streeta4j" event="onblur"
											reRender="streetErrMsg" ajaxSingle="true" limitToList="true" />
									</h:inputText>

									<rich:spacer width="5"></rich:spacer>

									<rich:message id="streetErrMsg" for="street" passedLabel="*"
										style='color:red; font-size: 11px;' showDetail="false"
										showSummary="true"></rich:message>



								</td>
							</tr>



							<tr align="left">
								<td align="right">
									<h:outputLabel for="city" value="city"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

									<rich:spacer width="9"></rich:spacer>

								</td>

								<td align="left">
									<h:inputText value="#{leadController.lead.city}" id="city"
										required="true" requiredMessage=" City is required."
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">


										<a4j:support id="citya4j" event="onblur" reRender="cityErrMsg"
											ajaxSingle="true" limitToList="true" />
									</h:inputText>

									<rich:spacer width="5"></rich:spacer>

									<rich:message id="cityErrMsg" for="city" passedLabel="*"
										style='color:red; font-size: 11px;' showDetail="false"
										showSummary="true"></rich:message>


								</td>
							</tr>


							<tr align="left">
								<td align="right">
									<h:outputLabel for="zipcode" value="zip code"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

									<rich:spacer width="9"></rich:spacer>

								</td>

								<td align="left">
									<h:inputText value="#{leadController.lead.zipcode}"
										id="zipcode"
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">

									</h:inputText>

									<rich:spacer width="5"></rich:spacer>

								</td>
							</tr>


							<tr align="left">
								<td align="right">
									<h:outputLabel for="state" value="state"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

									<rich:spacer width="9"></rich:spacer>

								</td>

								<td align="left">
									<h:inputText value="#{leadController.lead.state}" id="state"
										required="true" requiredMessage=" State is required."
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">

										<a4j:support id="statea4j" event="onblur"
											reRender="stateErrMsg" ajaxSingle="true" limitToList="true" />
									</h:inputText>

									<rich:spacer width="5"></rich:spacer>

									<rich:message id="stateErrMsg" for="state" passedLabel="*"
										style='color:red; font-size: 11px;' showDetail="false"
										showSummary="true"></rich:message>

								</td>
							</tr>


							<tr align="left">
								<td align="right">
									<h:outputLabel for="country" value="country"
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

									<rich:spacer width="9"></rich:spacer>

								</td>

								<td align="left">
									<h:inputText value="#{leadController.lead.country}"
										id="country" required="true"
										requiredMessage=" Country is required."
										style="background-position: left; background-color: WhiteSmoke; height: 20px; width: 150px; border-right-color: AntiqueWhite; border-bottom-color: AntiqueWhite; border-top-color: AntiqueWhite; border-left-color: AntiqueWhite; cursor: text">

										<a4j:support id="countrya4j" event="onblur"
											reRender="countryErrMsg" ajaxSingle="true" limitToList="true" />
									</h:inputText>

									<rich:spacer width="5"></rich:spacer>

									<rich:message id="countryErrMsg" for="country" passedLabel="*"
										style='color:red; font-size: 11px;' showDetail="false"
										showSummary="true"></rich:message>

								</td>
							</tr>



							<tr align="left">
								<td>
								</td>

								<td align="left">

									<a4j:commandButton style="width: 108px"
										action="#{leadController.createLead}" value="Create Lead"
										reRender="finalMsg">
									</a4j:commandButton>

								</td>


							</tr>


						</table>
						<table>
							<tr align="left">

								<td width="100%">
									<h:outputLabel id="finalMsg" value=""
										style='font-family: Georgia, "Times New Roman", Serif; font-size: 11px; color: SteelBlue'></h:outputLabel>

								</td>
							</tr>
						</table>
					</h:form>

				</rich:panel>
			</a4j:form>

		</f:view>
	</body>
</html>